const { DataTypes } = require('sequelize')

const seq = require('../db/seq')


//创建Food模型（建表）
const Food = seq.define('food', {
	food_name: {
		type: DataTypes.STRING,
		allowNull: false,
		comment: '名字'
	},
	price: {
		type: DataTypes.FLOAT,
		allowNull: false,
		comment: '价格'
	},
	tag: {
		type: DataTypes.STRING,
		allowNull: true,
		comment: '标签'
	},	
	address: {
		type: DataTypes.STRING,
		allowNull: false,
		comment: '地址'
	},
	isOnShelf:{
		type:DataTypes.BOOLEAN,
		allowNull:false,
		defaultValue: 1,
		comment:'是否删除'
	},
	detail: {
		type: DataTypes.STRING,
		allowNull: true,
		comment: '详细信息'
	},
	comments:{
		type: DataTypes.STRING,
		allowNull: true,
		comment: '评论'
	},
	mark:{
		type: DataTypes.FLOAT,
		allowNull: true,
		comment: '评分'
	}

})
//强制同步数据库(创建数据表)
// Food.sync({force:true});

module.exports = Food